<?php
//include file
include("../include/session.php");
require_once('../db_conn/conn_db.php');
require_once('header.php');
require_once('../calendar/calendar/classes/tc_calendar.php');

?>
<link rel="stylesheet" href="../ckeditor/sample.css">
<script src="../ckeditor/ckeditor.js"></script>
<script language="javascript" src="calendar/calendar/calendar.js"></script>
<SCRIPT LANGUAGE="JavaScript">
function fjs_formval()
	{
	error = 0;
	if (window.document.form.username.value == "")
	{
		alert("ATTENTION \n\nField User Name must be filled.");
		window.document.form.username.focus();
		error = 1;
	}
	
	else
	if (window.document.form.pass.value == "")
	{
		alert("ATTENTION \n\nField Password must be filled.");
		window.document.form.password.focus();
		error = 1;
	}
	
	if (error == 0)
		window.document.form.submit();
	else
	return false;
}</SCRIPT>
</HEAD>
<BODY>
<?php 
$action = (!empty($_GET['id'])) ? 'update' : 'save';
$result = get_Perjanjian($_GET['id']);
$row1 = mysql_fetch_array($result);
?>
<FORM ACTION=save_perjanjian.php?action=<?php echo $action?> method="post" name="form" id="form">
<table align="left" cellpadding="1" cellspacing="1" border="1">
    <input type=hidden name=status value="1" size=20>
	<input type=hidden name=id value="<?php echo $_GET['id']?>" size=20>
	<tr>
		<td class="pageName" colspan="2">Form Perjanjian</td>
	</tr>
	<tr> 
      <td>Order Name</td>
	  <td>
	  <?php 
		$result = get_all_order();
		
		echo "<select name=order_id>
		<option value='' selected=\"\">---pilih---</option>"; 
		while ($row = mysql_fetch_array($result)) {?>
			<option value=<?php echo $row[0]?> <?php if($row[0]==$row1['1']) echo "selected";?> ><?php echo $row[2] ?></option>";
		<?php } ?>
		</select>
		
	  </td>
    </tr>
      <td>Content</td>
	  <td>
	  <textarea class="ckeditor" name="content"><?php echo $row1[2]?></textarea>
	  </td>
    </tr>
	 <td><input type=submit value=Simpan onClick="javascript:return fjs_formval()"> <input type=reset value=Reset></td>
    </tr>
</table>
</FORM>
</BODY>
</HTML>
